<script>
console.log(1)
setTimeout(function() {
  console.log(2)
  new Promise(function(resolve) {
    console.log(3)
    resolve()
  }).then(function() {
    console.log(4)
  })
})

new Promise(function(resolve) {
  console.log(5)
  resolve()
}).then(function() {
  console.log(6)
})

setTimeout(function() {
  console.log(7)
  new Promise(function(resolve) {
    console.log(8)
    resolve()
  }).then(function() {
    console.log(9)
  })
})

console.log(10)

</script>
<!-- <script>
    console.log(1);

    setTimeout(() => {
        console.log(2);
    }, 0)

    let p = new Promise((resolve, reject) => {
        resolve(3)
    })

    p.then(res => {
        console.log(res);
    })


    console.log(4);

</script> -->